home *** CD-ROM | disk | FTP | other *** search
- <%@ Language=VBScript CODEPAGE=65001 %>
- <!--#include file="include/wmsLocStrings.inc"-->
- <!--#include file="include/wmsServerHash.inc"-->
- <!--#include file="include/wmsPlugins.inc"-->
- <!--#include file="include/wmsHeader.inc"-->
- <!--#include file="include/wmsPageBanner.inc"-->
- <!--#include file="include/wmsError.inc"-->
- <%
- '+-------------------------------------------------------------------------
- '
- ' Microsoft Windows Media
- ' Copyright (C) Microsoft Corporation. All rights reserved.
- '
- ' File: AuthenAnonUserAdmin.asp
- '
- ' Contents:
- '
- '--------------------------------------------------------------------------
-
- ConnectToPlugin
- ConnectToPluginAdmin
-
- BeginErrorHandling
-
- Dim bError
- Dim strUserName
- Dim strPassword
- Dim strPasswordConfirm
- Dim dwTabIndex
-
- bError = FALSE
- dwTabIndex = 0
-
- strUserName = Left( RemoveSpecifiedChars( SafeUnescape( trim( posting( "userName" ) ) ), REGEXT_ILLEGAL_UNAME_CHARS ), MAX_USERNAME )
- strPassword = Left( RemoveDangerousCharacters( SafeUnescape( trim( posting( "password" ) ) ) ), MAX_PASSWD )
- strPasswordConfirm = Left( RemoveDangerousCharacters( SafeUnescape( trim( posting( "confirm" ) ) ) ), MAX_PASSWD )
-
- Dim strOp
- strOp = trim( posting( "submit" ) )
- if( 0 < Len( strOp ) ) then
- if ( 0 < Len( strUserName ) ) then
- on error resume next
- if( 0 = strcomp( strPassword, strPasswordConfirm, vbTextCompare ) ) then
- if( 0 <> strcomp( strPassword, L_PASSWORDPHOLD_TEXT, vbTextCompare ) ) then
- if( DetectSpecifiedChars( strUserName, REGEXP_DANGEROUS_CHARS ) ) then
- Err.Raise( -2 )
- Err.Description = L_USERNAMEBADCHAR_TEXT
- ErrorDetected( "PluginAuthenAnonUserName" )
- bError = TRUE
- elseif( DetectSpecifiedChars( strPassword, REGEXP_DANGEROUS_CHARS ) ) then
- Err.Raise( -2 )
- Err.Description = L_PASSWORDBADCHAR_TEXT
- ErrorDetected( "PluginAuthenAnonPassword" )
- bError = TRUE
- elseif( ( MAX_PASSWD >= Len( strPassword ) ) and ( MAX_USERNAME >= Len( strUserName ) ) ) then
- s_WMSAdmin.SetAuthenAnonPluginCredentials g_objPluginAdmin, strUserName, strPassword
- if( ErrorDetected( "PluginAuthenAnonUserName" ) ) then
- bError = TRUE
- end if
- end if
- end if
- else
- err.Raise( -1 )
- err.Description = L_SPECIFYUSERNAME_TEXT
- bError = TRUE
- Session( "PageReloadedToDisplayError" ) = 1
- err.description = RemoveDangerousCharacters( L_PASSWORDMISMATCH_TEXT )
- ErrorDetected( "PluginAuthenAnonPasswordConf" )
- end if
-
- strPassword = Server.HTMLEncode( L_PASSWORDPHOLD_TEXT )
- strPasswordConfirm = Server.HTMLEncode( L_PASSWORDPHOLD_TEXT )
-
- if ( FALSE = bError ) then
- if( "" <> g_strEncodedPubPointName ) then
- Response.Redirect "../pubpoints/pubpoint_props.asp?server=" & g_strQueryStringServer & "&ppID=" & g_strPubPointID & "&category=" & g_strCategory & "&pluginIndex=" & GetPostOrQsVal("pluginIndex")
- else
- Response.Redirect "../server_props.asp?server=" & g_strQueryStringServer & "&category=" & g_strCategory & "&pluginIndex=" & GetPostOrQsVal("pluginIndex")
- end if
- end if
- else
- Err.Raise( -1 )
- Err.Description = RemoveDangerousCharacters( L_SPECIFYUSERNAME_TEXT )
- bError = TRUE
- Session( "PageReloadedToDisplayError" ) = 1
- ErrorDetected( "PluginAuthenAnonUserName" )
- end if
- else
- strUserName = g_objPluginAdmin.AnonymousUserName
- if( g_objPluginAdmin.IsPasswordSet ) then
- strPassword = Server.HTMLEncode( L_PASSWORDPHOLD_TEXT )
- strPasswordConfirm = Server.HTMLEncode( L_PASSWORDPHOLD_TEXT )
- else
- strPassword = ""
- strPasswordConfirm = ""
- end if
- end if
-
- WriteHTMLHeader( g_strDecodedServerName )
- %>
- <link rel="stylesheet" type="text/css" href="<%= Session( "cssName" ) %>">
- <% WritePluginJSUtils %>
- <script language="JavaScript">
- <!--
- /*@cc_on @*/
- var g_bBadUsernameAlerted = false;
-
-
- ///////////////////////////
- function RemoveBadUsernameChars( szUnfiltered )
- {
- <% jsTRY %>
- var szSafeString = new String( szUnfiltered );
- var re = /\<|\>|\"|`|!|@|#|\$|\%|\^|\||\[|\]|\;|\:|\?|\(|\)|\{|\}|\&|\u201C|\u201D|\u201E|\"\&/gim;
- szSafeString = szUnfiltered.replace( re, "" );
-
- return( szSafeString );
- <% jsCATCH %>
- }
-
- var g_bUserAlertedToBadUerName = false;
- var g_bUserAlertedToBadPasswd = false;
- var g_IsValidationMutexBusy = false;
-
- ///////////////////////////
- function CheckIfUserChanged()
- {
- <% jsTRY %>
- var szUser;
- var szPass;
- var szConfirm;
-
- if( document.forms.pluginForm.username.value == "<%= EscBackslashChar( Left( RemoveSpecifiedChars( SafeUnescape( trim( strUserName ) ), REGEXT_ILLEGAL_UNAME_CHARS ), MAX_USERNAME ) ) %>" )
- {
- return( false );
- }
-
- if( document.forms.pluginForm.password.value == "<%= Server.HTMLEncode( L_PASSWORDPHOLD_TEXT ) %>" )
- {
- document.forms.pluginForm.password.value = "";
- document.forms.pluginForm.confirm.value = "";
- return( true );
- }
-
- if( document.forms.pluginForm.confirm.value == "<%= Server.HTMLEncode( L_PASSWORDPHOLD_TEXT ) %>" )
- {
- document.forms.pluginForm.password.value = "";
- document.forms.pluginForm.confirm.value = "";
- return( true );
- }
-
- szUser = new String( document.forms.pluginForm.username.value );
- if( 0 == szUser.length )
- {
- return( true );
- }
- <% jsCATCH %>
- return( true );
- }
-
- ///////////////////////////
- function ValidateUserPass()
- {
- <% jsTRY %>
- var szUser = "";
- var szPass = "";
- var szConf = "";
- var bUserOkay = true;
- var bError = false;
- var bUserChanged = false;
-
- if( true == g_IsValidationMutexBusy )
- {
- return( true );
- }
- g_IsValidationMutexBusy = true;
-
- document.forms.pluginForm.ok.disabled = false;
-
- bUserChanged = CheckIfUserChanged();
-
- szUser = new String( document.forms.pluginForm.username.value )
- szPass = new String( document.forms.pluginForm.password.value )
- szConf = new String( document.forms.pluginForm.confirm.value )
-
- if( ( 0 == szUser.length ) && ( 0 == szPass.length ) && ( 0 == szConf.length ) )
- {
- // it's legal to clear all credentials
- if( false == bError )
- {
- document.forms.pluginForm.ok.disabled = false;
- window.status = "";
- }
- g_IsValidationMutexBusy = false;
- return( true );
- }
-
- if( ( 0 == szUser.length ) || bUserChanged )
- {
- document.forms.pluginForm.ok.disabled = ( 0 == szUser.length ) && ( ( 0 < szPass.length ) || ( 0 < szConf.length ) );
- }
-
- // check username
- var szFilteredUser = RemoveBadUsernameChars( szUser );
- if( szUser.length != szFilteredUser.length )
- {
- document.forms.pluginForm.username.style.color = "#FF0000";
- document.forms.pluginForm.ok.disabled = true;
- bError = true;
- window.status = "<%= L_USERNAMEBADCHAR_TEXT %>";
- if( false == g_bUserAlertedToBadUerName )
- {
- g_bUserAlertedToBadUerName = true;
- window.alert( "<%= L_INVALIDCHARSINUSERNAME_TEXT %>" );
- }
- }
- else
- {
- document.forms.pluginForm.username.style.color = "#000000";
- }
-
- // if any changes to pass or confirm, wipe canned password fields
- if( ( ( "<%= L_PASSWORDPHOLD_TEXT %>" == document.forms.pluginForm.password.value ) &&
- ( "<%= L_PASSWORDPHOLD_TEXT %>" != document.forms.pluginForm.confirm.value ) ) ||
- ( ( "<%= L_PASSWORDPHOLD_TEXT %>" != document.forms.pluginForm.password.value ) &&
- ( "<%= L_PASSWORDPHOLD_TEXT %>" == document.forms.pluginForm.confirm.value ) ) )
- {
- document.forms.pluginForm.password.value = document.forms.pluginForm.confirm.value = "";
- g_IsValidationMutexBusy = false;
- return( true );
- }
-
- // if any changes to username, wipe canned password fields
- if( ( ( 0 < szConf.length ) || ( 0 < szPass.length ) ) && ( szPass.length != szConf.length ) )
- {
- if( ( "<%= L_PASSWORDPHOLD_TEXT %>" == document.forms.pluginForm.password.value ) ||
- ( "<%= L_PASSWORDPHOLD_TEXT %>" == document.forms.pluginForm.confirm.value ) )
- {
- szPass = "";
- szConf = "";
- document.forms.pluginForm.password.value = document.forms.pluginForm.confirm.value = "";
- g_IsValidationMutexBusy = false;
- return( true );
- }
- }
-
- if( "<%= L_PASSWORDPHOLD_TEXT %>" != document.forms.pluginForm.password.value )
- {
- var szFilteredPass = RemoveDangerousCharacters( szPass );
- if( szPass.length != szFilteredPass.length )
- {
- document.forms.pluginForm.password.style.color = "#FF0000";
- document.forms.pluginForm.ok.disabled = true;
- szPass = "";
- bError = true;
- window.status = "<%= L_PASSWORDBADCHAR_TEXT %>";
- if( false == g_bUserAlertedToBadPasswd )
- {
- g_bUserAlertedToBadPasswd = true;
- window.alert( "<%= L_PASSWORDBADCHAR_TEXT %>" );
- }
- }
- else
- {
- document.forms.pluginForm.password.style.color = "#000000";
- }
- }
-
- if( "<%= L_PASSWORDPHOLD_TEXT %>" != document.forms.pluginForm.confirm.value )
- {
- var szFilteredConf = RemoveDangerousCharacters( szConf );
- if( szConf.length != szFilteredConf.length )
- {
- document.forms.pluginForm.confirm.style.color = "#FF0000";
- document.forms.pluginForm.ok.disabled = true;
- szConf = "";
- bError = true;
- window.status = "<%= L_PASSWORDBADCHAR_TEXT %>";
- if( false == g_bUserAlertedToBadPasswd )
- {
- g_bUserAlertedToBadPasswd = true;
- window.alert( "<%= L_PASSWORDBADCHAR_TEXT %>" );
- }
- }
- else
- {
- document.forms.pluginForm.confirm.style.color = "#000000";
- }
- }
-
- if( true == bError )
- {
- document.forms.pluginForm.ok.disabled = true;
- }
- else
- {
- window.status = "";
- if( ( 0 == szUser.length ) && ( 0 == szPass.length ) && ( 0 == szConf.length ) )
- {
- document.forms.pluginForm.ok.disabled = false;
- g_IsValidationMutexBusy = false;
- return( true );
- }
-
- if( ( false == bError ) && document.forms.pluginForm.password.value == document.forms.pluginForm.confirm.value )
- {
- if( 0 < szUser.length )
- {
- document.forms.pluginForm.ok.disabled = false;
- }
- g_IsValidationMutexBusy = false;
- return( true );
- }
- }
-
- document.forms.pluginForm.ok.disabled = true;
- g_IsValidationMutexBusy = false;
- return( true );
- <% jsCATCH %>
- }
- -->
- </script>
- </head>
- <body class="pluginBody" oncontextmenu="JavaScript:event.cancelBubble=true;return false;">
- <% DrawPluginBanner %>
- <table width=<%= Server.HTMLEncode( STDTABLEWIDTH ) %>>
- <tr>
- <td valign=top>
-
- <% WriteStdPluginForm %>
-
- <p>
-
-
- <p>
-
- <table class="propgroupbox" border=0 cellspacing=2 cellpadding=2 width=100%>
- <tr>
- <td colspan=3>
- <div align="left" class="helptext"><%= Server.HTMLEncode( L_AUTHENANONHELP_TEXT ) %></div><br>
- </td>
- </tr>
- <tr>
- <td class="defaultcursor">
- <% RenderWithErrorCheck Server.HTMLEncode( L_USERNAMECOLON_TEXT ), "PluginAuthenAnonUserName" %>
- </td>
- </tr>
- <tr>
- <td class="defaultcursor">
- <input
- type="text"
- name="username"
- onKeyUp="JavaScript:ValidateUserPass();"
- onKeyDown="JavaScript:ValidateUserPass();"
- onChange="JavaScript:ValidateUserPass();"
- onPaste="JavaScript:ValidateUserPass();"
- maxlength="<%= Server.HTMLEncode( MAX_USERNAME ) %>"
- value="<%= EscBackslashChar( Left( RemoveSpecifiedChars( SafeUnescape( trim( strUserName ) ), REGEXT_ILLEGAL_UNAME_CHARS ), MAX_USERNAME ) ) %>"
- tabindex=1
- AUTOCOMPLETE="OFF">
- </td>
- </tr>
- <tr>
- <td class="defaultcursor">
- <% RenderWithErrorCheck Server.HTMLEncode( L_PASSWORDCOLON_TEXT ), "PluginAuthenAnonPassword" %>
- </td>
- </tr>
- <tr>
- <td class="defaultcursor">
- <input
- type="password"
- name="password"
- value="<%= RemoveSpecifiedChars( strPassword, REGEXP_DANGEROUS_CHARS ) %>"
- onChange="JavaScript:ValidateUserPass();"
- onPaste="JavaScript:ValidateUserPass();"
- onKeyUp="JavaaScript:ValidateUserPass();"
- onKeyDown="JavaaScript:ValidateUserPass();"
- tabindex=2
- AUTOCOMPLETE="OFF">
- </td>
- </tr>
- <tr>
- <td class="defaultcursor">
- <% RenderWithErrorCheck Server.HTMLEncode( L_CONFIRMPASSCOLON_TEXT ), "PluginAuthenAnonPasswordConf" %>
- </td>
- </tr>
- <tr>
- <td class="defaultcursor">
- <input
- type="password"
- name="confirm"
- value="<%= RemoveSpecifiedChars( strPasswordConfirm, REGEXP_DANGEROUS_CHARS ) %>"
- onChange="JavaScript:ValidateUserPass();"
- onPaste="JavaScript:ValidateUserPass();"
- onKeyUp="JavaScript:ValidateUserPass();"
- onKeyDown="JavaScript:ValidateUserPass();"
- tabindex=3
- AUTOCOMPLETE="OFF">
- </td>
- </tr>
- </table>
- </td>
- </tr>
- <tr>
- <td>
- <br>
- </td>
- <td>
-
- </td>
- <tr>
- <td valign=bottom>
- <input type="submit" align="baseline" name="ok" value="<%= Server.HTMLEncode( L_OKAYBUTTON_TEXT ) %>" tabIndex=4>
- <input type="button" align="baseline" name="cancel" onclick="Cancel()" value="<%= Server.HTMLEncode( L_CANCELBUTTONSPACED_TEXT ) %>" tabIndex=5>
- <input type="button" align="baseline" name="help" onclick="JavaScript:DoPluginHelp( '<%= H_AUTHENANONUSERHELPTOPIC %>' )" value="<%= Server.HTMLEncode( L_HELPBUTTONSPACED_TEXT ) %>" id="help" tabindex=6>
- </td>
- </tr>
- </table>
- </font>
- </form>
- <%
- AlertUserWithPopupErrorDialog
- 'OnErrorGoBack
- DrawStdFooter
- %>
- </body>
- </html>
- <%
- LatchCurrentPage "plugins/AuthenAnonUserAdmin.asp", qs
- EndErrorHandling "AuthenAnonUserAdmin.asp"
-
- on error resume next
- PluginsASPCleanup
- %>
-
-